package navigation;

import java.util.*;

/**
 *
 * @author hyurah
 */

public class PathQueue {

	private List<PathPoint> queue = new ArrayList<PathPoint>();

	public void pushPoint(PathPoint p) {
		queue.add(p);
	}

	public PathPoint popPoint() {
		return queue.remove(0);
	}

	public PathPoint getPoint(int i) {
		return queue.get(i);
	}

	public PathPoint getLast() {
		return queue.get(queue.size()-1);
	}

	public int size() {
		return queue.size();
	}

	public PathQueue clone() {
		PathQueue clone = new PathQueue();
		for(int i=0; i<queue.size(); i++) {
			clone.queue.add(queue.get(i).clone());
		}
		return clone;
	}

	public String toString() {
		String result="";
		for(int i=0; i<queue.size(); i++) {
			result = result + (i+1) + ". X:" + queue.get(i).getX() + " Y:" + queue.get(i).getY() + " D:" + queue.get(i).getDirection() + "\n";
		}
		return result;
	}

}
